<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <style type="text/css">
        html{
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        body{
            width: 100%;
            height: 100%;
            background:url("img/beijing.jpg");
            background-repeat: no-repeat;
            background-position: center;
            background-size: cover;
            margin: 0;

        }
        #login{
            width: 300px;
            height: 300px;
            background-color:rgba(0,0,0,0.3);
            position: absolute;
            top: 50%;
            left: 50% ;
            margin: -150px 0 0 -150px;
        }
        #login h1{
            color: #fff;
            text-align:center;
            text-shadow: 0 0 10px;
            letter-spacing: 1px;
        }
        h1{
            font-size: 2em;
            margin: 0.67em 0;
        }
        input{
            width: 150px;
            height: 18px;
            margin-top: 20px;
            margin-bottom: 1px;
            margin-left: 75px;
            padding:2px;
            background-color:rgba(0,0,0,0.4);
            border: none;
            padding-left: 5px;
            color: #fff;
            font-size: 13px;
            text-shadow:white 1px 1px 0px;
            border-radius: 5px;
            border-top: 1px solid #312E3D;
            border-left:1px solid #312E3D;
            border-right: 1px solid #312E3D;
            border-bottom: 1px solid #56536A;
        }
        input:focus{
            outline: none;
            border: 1px solid red;
        }
        .btn{
            display: block;
            width: 159px;
            min-height: 20px;
            background-color: #4a77d4;
            outline: none;
            border: 1px solid #3762bc;
            color: #fff;
            font-size: 15px;
            line-height: normal;
            border-radius: 5px;
            margin: 30px 74px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div id="login">
    <h1>Login</h1>
    <form action="index.html" method="post">
        <input type="text" name="username" placeholder="账号">
        <input type="password" name="pwd" placeholder="密码">
        <button type="submit" class="btn" onclick="login()">登录</button>
    </form>
</div>
<script src="js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
    function login() {
        let username=document.getElementById("name").value;
        let password=document.getElementById("pass").value;
        if(username=="123456"&&password=="123456"){
            alert("登录成功");
            location.href="index.html"; 
            return false;
        }
        else {
            alert("账号或密码错误");
            location.href="登录页面.html";
            return false;
        }

    }
</script>
</body>
</html>